package com.diy.sigmund.junit5.mockito.argumentCaptor;

/**
 * @author ylm-sigmund
 * @since 2023/7/9 17:10
 */
public class EmailService {

    private DeliveryPlatform deliveryPlatform;

    public EmailService(DeliveryPlatform deliveryPlatform) {
        this.deliveryPlatform = deliveryPlatform;
    }

    public void send(String to, String subject, String body, boolean html) {
        EmailStyle emailStyle = EmailStyle.DOC;
        if(html) {
            emailStyle = EmailStyle.HTML;
        }

        Email email = new Email(to, subject, body);
        email.setEmailStyle(emailStyle);
        deliveryPlatform.deliver(email);
    }
}

